import java.util.Scanner;

public class fish_time {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int hour1 = sc.nextInt();
            int min1 = sc.nextInt();
            int hour2 = sc.nextInt();
            int min2 = sc.nextInt();
            int all1 = hour1*60 + min1;
            int all2 = hour2*60 + min2;
            int count = Math.abs(all1-all2);
            int hour3 =count/60;
            int min3 = count%60;
            System.out.println(hour3+" "+min3);

        }
    }

